package net.xo68.destiny.core.eventbus;

import com.lmax.disruptor.ExceptionHandler;
import lombok.extern.slf4j.Slf4j;

/**
 * 消息事件异常处理
 * @author wuxie
 * @version 2020-9-24
 */
@Slf4j
public class MessageEventExceptionHandler implements ExceptionHandler<MessageEvent> {

    @Override
    public void handleEventException(Throwable throwable, long sequence, MessageEvent event) {
        //throwable.printStackTrace();
        log.error("event type: {}, event body: {}, err: {}", event.getEventType(),event.getBody(), throwable);
    }

    @Override
    public void handleOnStartException(Throwable throwable) {
        //throwable.printStackTrace();
        log.error(throwable.getMessage(),throwable);
    }

    @Override
    public void handleOnShutdownException(Throwable throwable) {
        //throwable.printStackTrace();
        log.error(throwable.getMessage(),throwable);
    }
}